from rest_framework import serializers
from .models import *


class CityhotSerializers(serializers.ModelSerializer):

    class Meta:
        model = City
        fields = '__all__'


class EnterpriseSimpleSerializers(serializers.ModelSerializer):
    recruits = serializers.PrimaryKeyRelatedField(read_only=True, many=True)

    class Meta:
        model = Enterprise
        fields = '__all__'


class RecruitSerializers(serializers.ModelSerializer):
    enterprise = EnterpriseSimpleSerializers()
    users = serializers.StringRelatedField(many=True, read_only=True)

    class Meta:
        model = Recruit
        fields = '__all__'


class EnterpriseSerializers(serializers.ModelSerializer):
    recruits = RecruitSerializers(many=True)

    class Meta:
        model = Enterprise
        fields = '__all__'


class RecruitDetailSerializers(serializers.ModelSerializer):
    enterprise = EnterpriseSerializers()
    users = serializers.StringRelatedField(many=True, read_only=True)

    class Meta:
        model = Recruit
        fields = '__all__'
